//
//  ConditionalBootcamp_24.swift
//  SwiftUiExercise
//
//  Created by 徐鹏 on 2023/7/1.
//

import SwiftUI

struct ConditionalBootcamp_24: View {
    
    @State var showCircle: Bool = false
    @State var showRectangle: Bool = false
    @State var isLoading: Bool = false
    
    var body: some View {
        VStack(spacing: 20){
            
            Button("Circle Button: \(showCircle.description)") {
                showCircle.toggle()
                isLoading.toggle()
            }
            
            Button("Rectangle Button: \(showRectangle.description)") {
                showRectangle.toggle()
            }
            
            ZStack{
                if showRectangle{
                    Rectangle()
                        .frame(width: 100,height: 100)
                }else if showCircle{
                    Circle()
                        .fill(.green)
                        .frame(width: 100,height: 100)
                 
                }
                
                if isLoading {
                    ProgressView()
                }
            }
            
           
            
            Spacer()
      
            
        }
    }
}

struct ConditionalBootcamp_24_Previews: PreviewProvider {
    static var previews: some View {
        ConditionalBootcamp_24()
    }
}
